var EpgContent= function(opts){
	this.contentId =null;
	this.contentName =null;
	this.contentPoster = null;
	this.contentType = null;
	this.category = null;
	this.episodeIndex = null;
	this.programId = null;
	if(opts){
		Object.extend(this,opts);
	}
};
var EpgFavPath={add:'/fav/vod/add',remove:'/fav/vod/remove',list:'/fav/vod/list',exist:"/fav/vod/query"};
var EpgPlayPath={add:'/history/add',remove:'/history/remove',list:'/history/list',exist:"/history/get"}

var EpgUser = Class.create(EpgWidget,{
	initialize: function($super, id, opts,links) {
        $super(id,opts,links);    
        this.dataType="json";
        this.userId = id;
        this.path = opts.path;
        this.contextPath= opts.contextPath;
    },
    addFav:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;

    	$.ajax({
    		  type: "POST",
    		  url: this.contextPath+EpgFavPath.add,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    removeFav:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;
    	$.ajax({
    		  type: "POST",
    		  url: this.contextPath+EpgFavPath.remove,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    existFav:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;
    	$.ajax({
    		  type: "GET",
    		  url: this.contextPath+EpgFavPath.exist,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    listFav:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;
    	$.ajax({
    		  type: "GET",
    		  url: this.contextPath+EpgFavPath.list,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    addPlayHistory:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;
    	$.ajax({
    		  type: "POST",
    		  url: this.contextPath+EpgPlayPath.add,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    removePlayHistory:function(content,sucess,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;
    	$.ajax({
    		  type: "POST",
    		  url: this.contextPath+EpgPlayPath.remove,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    listPlayHistory:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;

    	$.ajax({
    		  type: "GET",
    		  url: this.contextPath+EpgPlayPath.list,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    },
    existPlayHistory:function(content,success,fail){
    	content['userId'] = this.userId;
    	content["path"] =  this.path;

    	$.ajax({
    		  type: "GET",
    		  url: this.contextPath+EpgPlayPath.exist,
    		  data: content,
    		  success: success,
    		  error:fail,
    		  dataType: this.dataType
    		});
    }
});